
var logger      = require('./log.js').logger;
var me          = require('./acc');

exports.makeSign=function(args, secret){
	var keys = Object.keys(args);
	keys = keys.sort();
	var newArgs = [];
	keys.forEach(function (key) {
		newArgs.push(key);
		newArgs.push(encodeURIComponent(args[key]));
	});
	newArgs.push(encodeURIComponent(secret));

	var oriSign = newArgs.join('');
	logger.debug("originSign:" + oriSign);
	var sign = me.md5(oriSign);
	logger.debug("Sign:" + sign);
	return sign;
};
